<template>
  <div class="home">
    <el-container>
      <el-header class="top-box">
        <el-row :gutter="20">
          <el-col :span="4">
            <img class="logo" src="../assets/logo.png" alt />
          </el-col>
          <el-col :span="16">
            <div class="grid-content bg-purple">16</div>
          </el-col>
          <el-col :span="4">
            <div class="info-box">
              <span>A56209</span>
              <el-link class="out-btn" type="primary">退出</el-link>
            </div>
          </el-col>
        </el-row>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <el-menu router="true">
            <el-menu-item v-for="i in tabList" :router="i.path" :key="i.name" :index="i.name">
              <template #title>{{i.meta.title}}</template>
            </el-menu-item>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import router from "../router/index";

export default defineComponent({
  name: "Home",
  setup() {
    let tabList = router.options.routes[0].children;
    console.log(tabList);
    // tabList = tabList.filter(v => {
    //   if (v.meta) {
    //     return v.meta.isShow;
    //   }
    // });
    return {
      tabList
    };
  },
  components: {}
});
</script>

<style lang="scss" scoped>
.top-box {
  background: #efefef;
  padding: 5px;
  .logo {
    width: 40px;
  }
  .info-box {
    text-align: right;
  }
  .out-btn {
    margin-left: 10px;
  }
}
</style>
